package com.authstr.login.controller;


import com.authstr.auth.controller.BasePageController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * 通用的页面跳转处理 控制层
 */
@Controller
public class PageController extends BasePageController {
    @RequestMapping("/")
    @Override
    public ModelAndView main(ModelAndView model) {
        model.setViewName(REDIRECT+"/login");
        return model;
    }

    /***
     * 共用的页面跳转,支持参数的自动添加
     * @param model
     * @param pkg
     * @param page
     * @param request
     * @return
     */
    @RequestMapping("pages/{pkg}/{page}")
    public ModelAndView page_view(ModelAndView model, @PathVariable("pkg") String pkg, @PathVariable("page") String page, HttpServletRequest request) {
        setModelAndViewPara(model,request);
//        setCommonPara(model);
        model.setViewName(getSystemSkin() + "/" + pkg + "/" + page);
        return model;
    }

}
